<!-- 使用 type="home" 属性设置首页 -->
<route type="home" lang="json5">
{
    style: { navigationBarTitleText: '%pages.index.index.title%' },
    name: 'home'
}
</route>

<template>
    <view class="min-h-100vh">
        <Home v-if="tabbar === 0" />
        <Ai v-if="tabbar === 1" />
        <My v-if="tabbar === 2" />

        <wd-tabbar fixed placeholder safeAreaInsetBottom v-model="tabbar">
            <wd-tabbar-item title="首页" icon="home"></wd-tabbar-item>
            <wd-tabbar-item title="Ai" icon="android"></wd-tabbar-item>
            <wd-tabbar-item title="我的" icon="user"></wd-tabbar-item>
        </wd-tabbar>
    </view>
</template>

<script setup lang="ts">
import { fetchLogin } from '@/service';
import Home from '@/pages/components/Home/index.vue';
import My from '@/pages/components/My/index.vue';
import Ai from '@/pages/components/Ai/index.vue';
const tabbar = ref(0);

const userInfo = ref();

onMounted(async () => {
    const { data, error } = await fetchLogin({ username: 'admin', password: '123456' }, { custom: { mock: true } });
    if (!error) {
        userInfo.value = data;
        console.log(userInfo.value);
    }
});
</script>
<style lang="scss"></style>
